package ckR

import (
	"db2s/go-log/log"
	"fmt"
	"os"
)

var writeLog *log.Logger

func debugWriteInfo(s string) {
	if writeLog != nil {
		writeLog.Debug(s)
	}
}
func infoWriteInfo(s string) {
	if writeLog != nil {
		writeLog.Info(s)
	}
}
func warnWriteInfo(s string) {
	if writeLog != nil {
		writeLog.Warn(s)
	}
}
func errorWriteInfo(s string) {
	if writeLog != nil {
		writeLog.Error(s)
	}
}

// dirInit  目录初始化
func dirInit(path string) (err error) {
	if _, err = os.Stat(path); err == nil {
		return
	}
	if !os.IsNotExist(err) {
		return
	}
	if err = os.MkdirAll(path, os.ModePerm); err != nil {
		return
	}
	return
}

// get schema table name
func getTableName(schema, table string) (s string) {
	return fmt.Sprintf("%s.%s", schema, table)
}
